import java.util.ArrayList;
import java.util.List;

public class Student {
    private String studentId;
    private String studentName;
    private String gender;
    private List<String> courseIds = new ArrayList<>(); // 所选课程编号列表

    public Student(String studentId, String studentName, String gender) {
        this.studentId = studentId;
        this.studentName = studentName;
        this.gender = gender;
    }

    // 选课方法
    public void selectCourse(String courseId) {
        courseIds.add(courseId);
        System.out.println(studentName + " 成功选修课程，课程编号：" + courseId);
    }

    // 退课方法
    public void dropCourse(String courseId) {
        if (courseIds.remove(courseId)) {
            System.out.println(studentName + " 成功退选课程，课程编号：" + courseId);
        } else {
            System.out.println(studentName + " 未选修该课程，课程编号：" + courseId);
        }
    }

    // Getter 方法
    public String getStudentId() {
        return studentId;
    }

    public String getStudentName() {
        return studentName;
    }

    public List<String> getCourseIds() {
        return courseIds;
    }
}
